A-2 Alloy Production Model
lp
FICO-Xpress
MOSEL
short
= PMIN(c)*produce
sum(r in RAW) P(r,c)*use(r) <= PMAX(c)*produce
end-do
! Use raw materials within their limit of availability
forall(r in RAW) use(r) <= AVAIL(r)
! Satisfy the demand
produce >= DEM
! Solve the problem
minimize(Cost)
! Solution printing
declarations
CNAME: array(RAW) of string
end-declarations
initializations from 'model.dat'
CNAME
end-initializations
writeln("Total cost: ", getobjval)
writeln("Amount of steel produced: ", getsol(produce))
writeln("Alloys used:")
forall(r in RAW)
if(getsol(use(r))>0) then
write(CNAME(r), ": ", getsol(use(r))," ")
end-if
write("\nPercentages (C, Cu, Mn): ")
forall(c in COMP)
write( getsol(sum(r in RAW) P(r,c)*use(r))/getsol(produce), "% ")
writeln
end-model]]>
BARRIER
From model a2alloy.mos, available on the Dash Web site.